<html><head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	  <title>会员中心 - 投稿编辑 - {muy:siteseo name='title'}</title>
	  <meta name="keywords" content="{muy:siteseo name='key'}" />
      <meta name="description" content="{muy:siteseo name='desc'}" />
	  <link href="__INDEXST__user/static/css/member_index.css" rel="stylesheet" type="text/css">
	  <link href="__INDEXST__user/static/icon/iconfont.css" rel="stylesheet" type="text/css" />
	  <link rel="stylesheet" href="__INDEXST__user/static/layer/theme/default/layer.css" id="layuicss-layer">
	  <script type="text/javascript" src="__INDEXST__user/static/js/jquery-1.8.2.min.js"></script>
      <script type="text/javascript" src="__INDEXST__user/static/layer/layer.js"></script> 
  </head>
  <body>
<!--头部-->
{include file='user/header'}
<!--头部end-->
<div class="yzm_member_container main">
    <!--侧边导航栏开始-->
      {include file='user/menu'}
      <!--侧边导航栏结束-->  
<div class="main_right">
        <div class="tit">
            <h3>在线投稿</h3>
        </div>
        <div class="main_cont">
            <form method="post" action="" onsubmit="return chcekall(this)">
                <table>
                    <tbody><tr>
                        <td class="text-right"><span class="red">*</span>文章标题：</td>
                        <td>
                        	<input type="text" name="articleTitle" id="articleTitle" value="{$article.title}" placeholder="请输入标题,最少5个字,最长35个字" required="" class="input">
                        </td>
                    </tr>
                    <tr>
                        <td class="text-right"><span class="red">*</span>导航栏目：</td>
                        <td>
                            <select name="articleClassify" class="select">
										<option value="" selected >请选择栏目</option>
										{foreach $menu as $val}
										{if condition="!empty($val.secontit)"}
										<option value="{$val.id}" {$article['mid'] == $val['id'] ? 'selected' : ''}>{$val.title}</option>
										{foreach $val.secontit as $va}
										<option value="{$va.id}" {$article['mid'] == $va['id'] ? 'selected' : ''}>ㅏ{$va.title}</option>
										{/foreach}
										{else /}
										<option value="{$val.id}" {$article['mid'] == $val['id'] ? 'selected' : ''}>{$val.title}</option>
										{/if}
										{/foreach}
									</select>
                                             
                        </td>
                    </tr>
                    <tr>
                        <td class="text-right"><span class="red">*</span>文章分类：</td>
                        <td id="checks">
                        	{foreach $type as $val}
							    <input type="checkbox" id="checkbox-{$val.id}" value="{$val.id}" name="type" {if condition="in_array($val.id,$article['type'])"}checked{/if}>
							    <label for="checkbox-{$val.id}" >{$val.title}</label>
								{/foreach}
                        </td>
                    </tr>
                    <tr>
                        <td class="text-right">关键词：</td>
                        <td>
                        	<input type="text" name="articleKeywords" id="articleKeywords" placeholder="文章关键词之间用英文“,”隔开" required="" value="{$article.keyword}" class="input">
                        </td>
                    </tr>
                    <tr>
                        <td class="text-right">TAG标签：</td>
                        <td>
                        	<input type="text" name="tag" id="tag" required="" placeholder="文章标签之间用英文“,”隔开" value="{$article.tag}" class="input">
                        </td>
                    </tr>
                    <tr>
                        <td class="text-right">文章来源：</td>
                        <td>
                        	<input type="text" id="articleSource" name="articleSource" placeholder="如：互联网" required="" value="{$article.source}" class="input">
                        </td>
                    </tr>
                    <tr>
                        <td class="text-right">文章内容：</td>
                        <td calss="up" style="width: 700px;">
                        	<textarea id="articleEditor" name="articleEditor"  class="textareas" type="text/plain" required=""  style="width:100%;height:400px;">{$article.editor|raw}</textarea>
                        </td>
                    </tr>
                    <tr>
                        <td class="text-right"><span class="red">*</span>验证码：</td>
                        <td> 
                        	<input type="text" placeholder="请输入验证码" class="input" required="" name="verif" id="captcha" style="width:150px;">
                            <img id="verif_img" src="{:captcha_src()}" onclick="this.src=this.src+'?'+Math.random()" class="yzm-code-img" title="看不清，换一张">
                        </td>
                    </tr>
                    <tr>
                        <td></td>
                        <td>
                            <!--隐藏字段-->
						    <input type="hidden" name="id" value="{$article.id}">
                        	<input type="submit" name="dosubmit" id="dosubmit" class="submit" value="提交">
                        </td>
                    </tr>
                </tbody></table>
            </form>
        </div>
    </div>
</div>
<!--百度编辑器开始-->
<script type="text/javascript" src="/public/static/admin/lib/ueditor/1.4.3/ueditor.config.js"></script>
<script type="text/javascript" src="/public/static/admin/lib/ueditor/1.4.3/ueditor.all.min.js"> </script>
<script type="text/javascript" src="/public/static/admin/lib/ueditor/1.4.3/lang/zh-cn/zh-cn.js"></script>
<!--百度编辑器结束-->
<!--底部开始-->
{include file='user/footer'}
<!--底部结束-->
<style>
/*.up{padding-left: 18px;width:100%;
    }*/
.input, .yzm-input-text {
    width: 100%;
}
.text-right{
    text-align: right;
    width: 100px;
    
}
</style>
<script type="text/javascript">

// 文章内容 实例化百度富文本编辑器
	var ue = UE.getEditor('articleEditor');
 function chcekall(obj) {
			 var articleTitle=$("#articleTitle").val();
			if( articleTitle== ''){
				layer.msg('文章标题不能为空！', {icon:2,time: 1000});
				$("#articleTitle").focus();
				return false;
			}
			
			var captcha=$("#captcha").val();
            if( captcha== ''){
				layer.msg('验证码不能为空！', {icon:2,time: 1000});
				$("#captcha").focus();
				return false;
			}
			var type=$("#checks input:checkbox");
			var str="";
			for(i=0;i<type.length;i++){
				if($(type[i]).is(":checked")){
					str += $(type[i]).val()+',';
				}
			}
            if( str== 0){
				layer.msg('分类不能为空！', {icon:2,time: 1000});
				//$("#type").focus();
				return false;
			}
			
		    var dosubmit = false;
			$.ajax({   
				type: "post",   
				url: "{:url('User/tg_edits')}",   
				dataType: "json",
				async: false,
				data:  $(obj).serialize(),
				//console.log(data);
				success: function(msg){  
					if(msg.code == 1){
						//dosubmit = true;
						layer.msg(msg.msg, {icon:1,time: 3000}, function() {
							if(msg.url) location.href = msg.url;
							});
					}else{
						if(msg.code == 0){
							$('#captcha+img').attr('src',$('#captcha+img').attr('src') + '?' + Math.random());
							$("#captcha").focus();
						}
						layer.msg(msg.msg, {icon:2,time: 2000});
					}				 
				} 
			});
			return dosubmit ? true : false;
		}


</script>
		
  
</body></html>